{"ast":null,"code":"var _jsxFileName = \"/data/messenger.client/src/components/ContactItem/index.tsx\",\n  _s = $RefreshSig$();\nimport React from 'react';\nimport classNames from \"classnames\";\nimport { Modal, UserItem } from \"../index\";\nimport { observer } from \"mobx-react-lite\";\nimport { Context } from \"../../index\";\nimport './ContactItem.scss';\nimport { jsxDEV as _jsxDEV } from \"react/jsx-dev-runtime\";\nconst ContactItem = props => {\n  _s();\n  const {\n    store\n  } = React.useContext(Context);\n  const [showModalOnRequest, setShowModalOnRequest] = React.useState(false);\n  const [showModalOnSent, setShowModalOnSent] = React.useState(false);\n  const [showModalOnAll, setShowModalOnAll] = React.useState(false);\n  if (props.addRequest) {\n    return /*#__PURE__*/_jsxDEV(\"div\", {\n      className: classNames(\"contacts__item\", \"contacts__item-add-requests\"),\n      children: [props.currentUser.id === props.contact.toUser.id && /*#__PURE__*/_jsxDEV(UserItem, {\n        profile: props.contact.fromUser\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 19,\n        columnNumber: 25\n      }, this) || /*#__PURE__*/_jsxDEV(UserItem, {\n        profile: props.contact.toUser\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 21,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"contacts__item-control\",\n        children: [/*#__PURE__*/_jsxDEV(\"button\", {\n          className: classNames(\"contacts__item-control-button\", \"contacts__item-control-button-accept\"),\n          onClick: () => store.acceptContactFromAPI(props.contact, props.index)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 24,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(\"button\", {\n          className: classNames(\"contacts__item-control-button\", \"contacts__item-control-button-delete\"),\n          onClick: () => {\n            setShowModalOnRequest(true);\n          }\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 28,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(Modal, {\n          active: showModalOnRequest,\n          title: \"Удаление входящей заявки\",\n          hasFunctionButtons: true,\n          onSubmit: () => {\n            store.deleteContactFromAPI(props.contact, props.index).then(() => setShowModalOnRequest(false));\n          },\n          onClose: () => setShowModalOnRequest(false),\n          customClassNameButtonSecond: \"messenger__sidebar-profileControl-deleteProfile\",\n          children: /*#__PURE__*/_jsxDEV(\"div\", {\n            children: \"\\u0412\\u044B \\u0434\\u0435\\u0439\\u0441\\u0442\\u0432\\u0438\\u0442\\u0435\\u043B\\u044C\\u043D\\u043E \\u0445\\u043E\\u0442\\u0438\\u0442\\u0435 \\u0431\\u0435\\u0437\\u0432\\u043E\\u0437\\u0432\\u0440\\u0430\\u0442\\u043D\\u043E \\u0443\\u0434\\u0430\\u043B\\u0438\\u0442\\u044C \\u0437\\u0430\\u044F\\u0432\\u043A\\u0443?\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 46,\n            columnNumber: 25\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 34,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 23,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 17,\n      columnNumber: 13\n    }, this);\n  } else if (props.sentRequest) {\n    return /*#__PURE__*/_jsxDEV(\"div\", {\n      className: classNames(\"contacts__item\", \"contacts__item-sent-requests\"),\n      children: [props.currentUser.id === props.contact.toUser.id && /*#__PURE__*/_jsxDEV(UserItem, {\n        profile: props.contact.fromUser\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 55,\n        columnNumber: 25\n      }, this) || /*#__PURE__*/_jsxDEV(UserItem, {\n        profile: props.contact.toUser\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 57,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"contacts__item-control\",\n        children: [/*#__PURE__*/_jsxDEV(\"button\", {\n          className: classNames(\"contacts__item-control-button\", \"contacts__item-control-button-delete\"),\n          onClick: () => {\n            setShowModalOnSent(true);\n          }\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 60,\n          columnNumber: 21\n        }, this), /*#__PURE__*/_jsxDEV(Modal, {\n          active: showModalOnSent,\n          title: \"Удаление исходящей заявки\",\n          hasFunctionButtons: true,\n          onSubmit: () => {\n            store.deleteContactFromAPI(props.contact, props.index).then(() => setShowModalOnSent(false));\n          },\n          onClose: () => setShowModalOnSent(false),\n          customClassNameButtonSecond: \"messenger__sidebar-profileControl-deleteProfile\",\n          children: /*#__PURE__*/_jsxDEV(\"div\", {\n            children: \"\\u0412\\u044B \\u0434\\u0435\\u0439\\u0441\\u0442\\u0432\\u0438\\u0442\\u0435\\u043B\\u044C\\u043D\\u043E \\u0445\\u043E\\u0442\\u0438\\u0442\\u0435 \\u0431\\u0435\\u0437\\u0432\\u043E\\u0437\\u0432\\u0440\\u0430\\u0442\\u043D\\u043E \\u0443\\u0434\\u0430\\u043B\\u0438\\u0442\\u044C \\u0437\\u0430\\u044F\\u0432\\u043A\\u0443?\"\n          }, void 0, false, {\n            fileName: _jsxFileName,\n            lineNumber: 78,\n            columnNumber: 25\n          }, this)\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 66,\n          columnNumber: 21\n        }, this)]\n      }, void 0, true, {\n        fileName: _jsxFileName,\n        lineNumber: 59,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 53,\n      columnNumber: 13\n    }, this);\n  } else {\n    return /*#__PURE__*/_jsxDEV(\"div\", {\n      className: classNames(\"contacts__item\", \"contacts__item-all-accepted\"),\n      children: [props.currentUser.id === props.contact.toUser.id && /*#__PURE__*/_jsxDEV(UserItem, {\n        profile: props.contact.fromUser\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 87,\n        columnNumber: 25\n      }, this) || /*#__PURE__*/_jsxDEV(UserItem, {\n        profile: props.contact.toUser\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 89,\n        columnNumber: 21\n      }, this), /*#__PURE__*/_jsxDEV(\"div\", {\n        className: \"contacts__item-control\",\n        children: /*#__PURE__*/_jsxDEV(\"button\", {\n          className: classNames(\"contacts__item-control-button\", \"contacts__item-control-button-delete\"),\n          onClick: () => {\n            setShowModalOnAll(true);\n          }\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 92,\n          columnNumber: 21\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 91,\n        columnNumber: 17\n      }, this), /*#__PURE__*/_jsxDEV(Modal, {\n        active: showModalOnAll,\n        title: \"Удаление контакта\",\n        hasFunctionButtons: true,\n        onSubmit: () => {\n          store.deleteContactFromAPI(props.contact, props.index).then(() => setShowModalOnAll(false));\n        },\n        onClose: () => setShowModalOnAll(false),\n        customClassNameButtonSecond: \"messenger__sidebar-profileControl-deleteProfile\",\n        children: /*#__PURE__*/_jsxDEV(\"div\", {\n          children: \"\\u0412\\u044B \\u0434\\u0435\\u0439\\u0441\\u0442\\u0432\\u0438\\u0442\\u0435\\u043B\\u044C\\u043D\\u043E \\u0445\\u043E\\u0442\\u0438\\u0442\\u0435 \\u0431\\u0435\\u0437\\u0432\\u043E\\u0437\\u0432\\u0440\\u0430\\u0442\\u043D\\u043E \\u0443\\u0434\\u0430\\u043B\\u0438\\u0442\\u044C \\u043A\\u043E\\u043D\\u0442\\u0430\\u043A\\u0442?\"\n        }, void 0, false, {\n          fileName: _jsxFileName,\n          lineNumber: 111,\n          columnNumber: 21\n        }, this)\n      }, void 0, false, {\n        fileName: _jsxFileName,\n        lineNumber: 99,\n        columnNumber: 17\n      }, this)]\n    }, void 0, true, {\n      fileName: _jsxFileName,\n      lineNumber: 85,\n      columnNumber: 13\n    }, this);\n  }\n};\n_s(ContactItem, \"U+euzveu6yLFKGKevBTqwG4WHzY=\");\n_c = ContactItem;\nexport default _c2 = observer(ContactItem);\nvar _c, _c2;\n$RefreshReg$(_c, \"ContactItem\");\n$RefreshReg$(_c2, \"%default%\");","map":{"version":3,"names":["React","classNames","Modal","UserItem","observer","Context","ContactItem","props","store","useContext","showModalOnRequest","setShowModalOnRequest","useState","showModalOnSent","setShowModalOnSent","showModalOnAll","setShowModalOnAll","addRequest","currentUser","id","contact","toUser","fromUser","acceptContactFromAPI","index","deleteContactFromAPI","then","sentRequest"],"sources":["/data/messenger.client/src/components/ContactItem/index.tsx"],"sourcesContent":["import React from 'react';\nimport classNames from \"classnames\";\nimport {ContactItemProps} from \"../../models/props/ContactItemProps\";\nimport {Modal, UserItem} from \"../index\";\nimport {observer} from \"mobx-react-lite\";\nimport {Context} from \"../../index\";\nimport './ContactItem.scss';\n\nconst ContactItem: React.FC<ContactItemProps> = (props) => {\n    const {store} = React.useContext(Context);\n    const [showModalOnRequest, setShowModalOnRequest] = React.useState<boolean>(false);\n    const [showModalOnSent, setShowModalOnSent] = React.useState<boolean>(false);\n    const [showModalOnAll, setShowModalOnAll] = React.useState<boolean>(false);\n\n    if (props.addRequest) {\n        return (\n            <div className={classNames(\"contacts__item\", \"contacts__item-add-requests\")}>\n                {(props.currentUser.id === props.contact.toUser.id &&\n                        <UserItem profile={props.contact.fromUser} />\n                    ) ||\n                    <UserItem profile={props.contact.toUser} />\n                }\n                <div className=\"contacts__item-control\">\n                    <button className={classNames(\"contacts__item-control-button\",\n                        \"contacts__item-control-button-accept\")}\n                        onClick={() => store.acceptContactFromAPI(props.contact, props.index)}\n                    />\n                    <button className={classNames(\"contacts__item-control-button\",\n                        \"contacts__item-control-button-delete\")}\n                        onClick={() => {\n                            setShowModalOnRequest(true);\n                        }}\n                    />\n                    <Modal\n                        active={showModalOnRequest}\n                        title={\"Удаление входящей заявки\"}\n                        hasFunctionButtons={true}\n                        onSubmit={() => {\n                            store.deleteContactFromAPI(props.contact, props.index).then(() =>\n                                setShowModalOnRequest(false)\n                            );\n                        }}\n                        onClose={() => setShowModalOnRequest(false)}\n                        customClassNameButtonSecond={\"messenger__sidebar-profileControl-deleteProfile\"}\n                    >\n                        <div>Вы действительно хотите безвозвратно удалить заявку?</div>\n                    </Modal>\n                </div>\n            </div>\n        );\n    } else if (props.sentRequest) {\n        return (\n            <div className={classNames(\"contacts__item\", \"contacts__item-sent-requests\")}>\n                {(props.currentUser.id === props.contact.toUser.id &&\n                        <UserItem profile={props.contact.fromUser} />\n                    ) ||\n                    <UserItem profile={props.contact.toUser} />\n                }\n                <div className=\"contacts__item-control\">\n                    <button className={classNames(\"contacts__item-control-button\",\n                        \"contacts__item-control-button-delete\")}\n                        onClick={() => {\n                            setShowModalOnSent(true);\n                        }}\n                    />\n                    <Modal\n                        active={showModalOnSent}\n                        title={\"Удаление исходящей заявки\"}\n                        hasFunctionButtons={true}\n                        onSubmit={() => {\n                            store.deleteContactFromAPI(props.contact, props.index).then(() =>\n                                setShowModalOnSent(false)\n                            );\n                        }}\n                        onClose={() => setShowModalOnSent(false)}\n                        customClassNameButtonSecond={\"messenger__sidebar-profileControl-deleteProfile\"}\n                    >\n                        <div>Вы действительно хотите безвозвратно удалить заявку?</div>\n                    </Modal>\n                </div>\n            </div>\n        );\n    } else {\n        return (\n            <div className={classNames(\"contacts__item\", \"contacts__item-all-accepted\")}>\n                {(props.currentUser.id === props.contact.toUser.id &&\n                        <UserItem profile={props.contact.fromUser} />\n                    ) ||\n                    <UserItem profile={props.contact.toUser} />\n                }\n                <div className=\"contacts__item-control\">\n                    <button className={classNames(\"contacts__item-control-button\",\n                        \"contacts__item-control-button-delete\")}\n                        onClick={() => {\n                            setShowModalOnAll(true);\n                        }}\n                    />\n                </div>\n                <Modal\n                    active={showModalOnAll}\n                    title={\"Удаление контакта\"}\n                    hasFunctionButtons={true}\n                    onSubmit={() => {\n                        store.deleteContactFromAPI(props.contact, props.index).then(() =>\n                            setShowModalOnAll(false)\n                        );\n                    }}\n                    onClose={() => setShowModalOnAll(false)}\n                    customClassNameButtonSecond={\"messenger__sidebar-profileControl-deleteProfile\"}\n                >\n                    <div>Вы действительно хотите безвозвратно удалить контакт?</div>\n                </Modal>\n            </div>\n        );\n    }\n}\n\nexport default observer(ContactItem);"],"mappings":";;AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,UAAU,MAAM,YAAY;AAEnC,SAAQC,KAAK,EAAEC,QAAQ,QAAO,UAAU;AACxC,SAAQC,QAAQ,QAAO,iBAAiB;AACxC,SAAQC,OAAO,QAAO,aAAa;AACnC,OAAO,oBAAoB;AAAC;AAE5B,MAAMC,WAAuC,GAAIC,KAAK,IAAK;EAAA;EACvD,MAAM;IAACC;EAAK,CAAC,GAAGR,KAAK,CAACS,UAAU,CAACJ,OAAO,CAAC;EACzC,MAAM,CAACK,kBAAkB,EAAEC,qBAAqB,CAAC,GAAGX,KAAK,CAACY,QAAQ,CAAU,KAAK,CAAC;EAClF,MAAM,CAACC,eAAe,EAAEC,kBAAkB,CAAC,GAAGd,KAAK,CAACY,QAAQ,CAAU,KAAK,CAAC;EAC5E,MAAM,CAACG,cAAc,EAAEC,iBAAiB,CAAC,GAAGhB,KAAK,CAACY,QAAQ,CAAU,KAAK,CAAC;EAE1E,IAAIL,KAAK,CAACU,UAAU,EAAE;IAClB,oBACI;MAAK,SAAS,EAAEhB,UAAU,CAAC,gBAAgB,EAAE,6BAA6B,CAAE;MAAA,WACtEM,KAAK,CAACW,WAAW,CAACC,EAAE,KAAKZ,KAAK,CAACa,OAAO,CAACC,MAAM,CAACF,EAAE,iBAC1C,QAAC,QAAQ;QAAC,OAAO,EAAEZ,KAAK,CAACa,OAAO,CAACE;MAAS;QAAA;QAAA;QAAA;MAAA,QAAG,iBAEjD,QAAC,QAAQ;QAAC,OAAO,EAAEf,KAAK,CAACa,OAAO,CAACC;MAAO;QAAA;QAAA;QAAA;MAAA,QAAG,eAE/C;QAAK,SAAS,EAAC,wBAAwB;QAAA,wBACnC;UAAQ,SAAS,EAAEpB,UAAU,CAAC,+BAA+B,EACzD,sCAAsC,CAAE;UACxC,OAAO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